package com.tenbent.product.base.service;

import com.tenbent.product.base.bo.BizObject;
import com.tenbent.product.base.exception.TenbentException;
import com.tenbent.product.base.query.page.PageResult;
import com.tenbent.product.base.query.page.Pageable;

import java.util.List;
import java.util.Map;

/**
 * 数据访问基类
 * 
 * @author Randy Yan
 *
 *         Created by ThinkPad on 2017/7/27.
 */
public interface BaseService<T> {

	void add(T entity) throws TenbentException;

	void addContainPk(T entity) throws TenbentException;

	void update(T entity) throws TenbentException;

	void delete(T entity) throws TenbentException;

	void delete(Integer id, Integer modiferId) throws TenbentException;

	void deleteLogic(T entity) throws TenbentException;

	void deleteLogic(Integer id, Integer modiferId) throws TenbentException;

	void deleteByIds(Integer[] ids, Integer modiferId) throws TenbentException;

	void deleteLogicByIds(Integer[] ids, Integer modiferId) throws TenbentException;

	T getByKey(T entity) throws TenbentException;

	T getByKey(Integer key) throws TenbentException;

	List<T> getAll() throws TenbentException;

	List<T> queryObj(T entity) throws TenbentException;

	List<Map<String, Object>> queryObjToMap(T entity) throws TenbentException;

	T queryUniqueObj(T entity) throws TenbentException;

	Map<String, Object> queryUniqueObjToMap(T entity) throws TenbentException;

	List<T> queryMap(Map<String, Object> paramMap) throws TenbentException;

	List<Map<String, Object>> queryMapToMap(Map<String, Object> paramMap) throws TenbentException;

	T queryUniqueMap(Map<String, Object> paramMap) throws TenbentException;

	Map<String, Object> queryUniqueMapToMap(Map<String, Object> paramMap) throws TenbentException;

	PageResult<T> queryPageObj(Pageable pageable) throws TenbentException;

	PageResult<Map<String, Object>> queryPageObjToMap(Pageable pageable) throws TenbentException;

	PageResult<T> queryPageMap(Pageable pageable) throws TenbentException;

	PageResult<Map<String, Object>> queryPageMapToMap(Pageable pageable) throws TenbentException;

	void setClazz(Class<? extends BizObject> clazz);

}
